package cn.edu.besti.cs1723.Z2316;

public class Sorting<T extends Comparable<? super T>> {

    public Sorting(){

    }

    public void selectionSort(T[] data) {
        int min;
        T temp;
        for (int index = 0; index < data.length - 1; index++) {
            min = index;
            for (int scan = index + 1; scan < data.length; scan++)
                if (data[scan].compareTo(data[min]) < 0)
                    min = scan;

            temp = data[min];
            data[min] = data[index];
            data[index] = temp;
        }
    }
}
